﻿using MengLin.OOP.DesignPattern.Decorator.CarDecorations.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MengLin.OOP.DesignPattern.Decorator.CarDecorations
{
    public partial class CarDecorationsFrm : Form
    {
        public CarDecorationsFrm()
        {
            InitializeComponent();
        }

        private void btnCarDecorations_Click(object sender, EventArgs e)
        {
            A4Car a4 = new A4Car();
            Console.WriteLine(a4.GetDescription() + "-Sale price:" + a4.GetSalePrice() + "-Cost:" + a4.GetCost());

            A6Car a6 = new A6Car();
            Console.WriteLine(a6.GetDescription() + "-Sale price:" + a6.GetSalePrice() + "-Cost:" + a6.GetCost());

            //设置装饰后的成本，销售价，描述
            MengLin.OOP.DesignPattern.Decorator.CarDecorations.Models.Decorator decorator = new GPS();
            decorator.SetCar(a4);
             MengLin.OOP.DesignPattern.Decorator.CarDecorations.Models.Decorator decorator2 = new GPS();
            decorator.SetCar(decorator2);
            Console.WriteLine(decorator.GetDescription() + "-Sale price:" + decorator.GetSalePrice() + "-Cost:" + decorator.GetCost());

            Console.Read();
        }
    }
}
